<xsl:stylesheet version='2.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
  xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:csharp="http://csharp.org"
  xsi:schemaLocation='urn:oasis:names:tc:emergency:EDXL:HAVE:1.0 edxl-have_pr3.xsd'
  xmlns:cap = 'urn:oasis:names:tc:emergency:cap:1.2'
  xmlns:have='urn:oasis:names:tc:emergency:EDXL:HAVE:1.0'
  xmlns:de='urn:oasis:names:tc:emergency:EDXL:DE:1.0'
  xmlns:n3='http://www.georss.org/georss'
  xmlns:gml='http://www.opengis.net/gml'
  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
  xmlns:xal='urn:oasis:names:tc:ciq:xal:3'
  xmlns:xnl='urn:oasis:names:tc:ciq:xnl:3'
  xmlns:xpil='urn:oasis:names:tc:ciq:xpil:3'
		>

  <xsl:import href="Area Scripts.xsl"/>

  <xsl:output method="html" indent="yes" exclude-result-prefixes="msxsl csharp"/>



  <xsl:template match="*">

    <HTML>
      <HEAD>

        <STYLE TYPE="text/css">
          .indented
          {
          padding-left: 50pt;
          padding-right: 50pt;
          }

          .indented2
          {
          padding-left: 75pt;
          padding-right: 50pt;
          }

          .indented3
          {
          padding-left: 100pt;
          padding-right: 50pt;
          }

          .indented4
          {
          padding-left: 125pt;
          padding-right: 50pt;
          }
        </STYLE>




        <style type="text/css">
          #map-canvas {
          height: 500px;
          }
        </style>

        <script type="text/javascript">
          <xsl:attribute name="src">http://www.google.com/jsapi?autoload={'modules':[{name:'maps',version:3,other_params:'sensor=false'}]}</xsl:attribute>
        </script>

        <script type="text/javascript">


          //http://code.google.com/apis/maps/articles/mvcfun.html
          /**
          * A radius widget that add a circle to a map and centers on a marker.
          *
          * @constructor
          */
          function RadiusWidget(map) {
          this.set('map', map);
          this.set('position', map.getCenter());


          var circle = new google.maps.Circle({
          strokeWeight: 2});

          // Bind the radiusWidget map to the DistanceWidget map
          //this.bindTo('map', this);

          // Bind the radiusWidget center to the DistanceWidget position
          //radiusWidget.bindTo('center', this, 'position');


          // Set the distance property value, default to 50km.
          this.set('distance', 50);

          // Bind the RadiusWidget bounds property to the circle bounds property.
          this.bindTo('bounds', circle);

          // Bind the circle center to the RadiusWidget center property
          circle.bindTo('center', this);

          // Bind the circle map to the RadiusWidget map
          circle.bindTo('map', this);

          // Bind the circle radius property to the RadiusWidget radius property
          circle.bindTo('radius', this);
          }
          RadiusWidget.prototype = new google.maps.MVCObject();


          /**
          * Update the radius when the distance has changed.
          */
          RadiusWidget.prototype.distance_changed = function() {
          this.set('radius', this.get('distance') * 1000);
          };

          function init() {
          /*
          var mapDiv = document.getElementById('map-canvas');
          var map = new google.maps.Map(mapDiv, {
          center: new google.maps.LatLng(37.790234970864, -122.39031314844),
          zoom: 8,
          mapTypeId: google.maps.MapTypeId.ROADMAP
          });

          // Create a new radius widget
          var radiusWidget = new RadiusWidget(map);
          */
          }

          google.maps.event.addDomListener(window, 'load', init);




        </script>





        <script type="text/javascript">
          <xsl:value-of select="document('CommonJavascript.js')" disable-output-escaping="yes" />
        </script>

        <TITLE>CAP Message</TITLE>
        <link rel="stylesheet" media="screen" type="text/css" href="css/style.css" />
      </HEAD>
      <BODY>

        <!--Comment -->
        <CENTER>
          <h1>
            <u>CAP Message</u>
          </h1>
        </CENTER>




        <TABLE bordercolor="#ababab" border="1px" cellpadding="10" cellspacing="0" width="1000">






          <TR>
            <TD  colspan="4" bgcolor="#F2F2F2">


              <xsl:for-each select="//cap:alert">
                <b>CAP ALERT </b>
                <BR/>
                <BR/>

                <P CLASS="indented2">

                  <b>Identifier: </b>
                  <xsl:value-of select="cap:identifier"/>
                  <BR/>
                  <BR/>
                  <b>Sender: </b>
                  <xsl:value-of select="cap:sender"/>
                  <BR/>
                  <BR/>
                  <b>Sent: </b>
                  <xsl:value-of select="cap:sent"/>
                  <BR/>
                  <BR/>
                  <b>Status: </b>
                  <xsl:value-of select="cap:status"/>
                  <BR/>
                  <BR/>
                  <b>MsgType: </b>
                  <xsl:value-of select="cap:msgType"/>
                  <BR/>
                  <BR/>
                  <b>Source: </b>
                  <xsl:value-of select="cap:source"/>
                  <BR/>
                  <BR/>
                  <b>Scope: </b>
                  <xsl:value-of select="cap:scope"/>
                  <BR/>
                  <BR/>
                  <b>Restriction: </b>
                  <xsl:value-of select="cap:restriction"/>
                  <BR/>
                  <BR/>
                  <b>Addresses: </b>
                  <xsl:value-of select="cap:addresses"/>
                  <BR/>
                  <BR/>
                  <b>Codes: </b>
                  <BR/>
                </P>

                <P CLASS="indented3">
                  <xsl:for-each select="cap:code">

                    <xsl:value-of select="."/>
                    <BR/>

                  </xsl:for-each>
                </P>

                <b>Note: </b>
                <xsl:value-of select="cap:note"/>
                <BR/>
                <BR/>
                <b>References: </b>
                <xsl:value-of select="cap:references"/>
                <BR/>
                <BR/>

                <P CLASS="indented2">
                  <b>Incidents: </b>
                  <xsl:value-of select="cap:incidents"/>
                  <BR/>
                  <BR/>

                  <hr/>

                  <xsl:for-each select="cap:info">
                    <b>Info</b>
                    <br></br>
                    <P CLASS="indented3">
                      <b>Language: </b>
                      <xsl:value-of select="cap:language"/>
                      <BR/>
                      <BR/>
                      <b>Categories: </b>
                      <br/>
                    </P>

                    <P CLASS="indented4">
                      <xsl:for-each select="cap:category">

                        <xsl:value-of select="."/>
                        <BR/>

                      </xsl:for-each>
                    </P>


                    <P CLASS="indented3">
                      <b>Event: </b>
                      <xsl:value-of select="cap:event"/>
                      <BR/>
                      <BR/>

                      <b>ResponseType: </b>
                    </P>

                    <P CLASS="indented4">
                      <xsl:for-each select="cap:responseType">
                        <xsl:value-of select="."/>
                        <BR/>
                      </xsl:for-each>
                    </P>

                    <P CLASS="indented3">
                      <b>Urgency: </b>
                      <xsl:value-of select="cap:urgency"/>
                      <BR/>
                      <BR/>
                      <b>Severity: </b>
                      <xsl:value-of select="cap:severity"/>
                      <BR/>
                      <BR/>
                      <b>Certainty: </b>
                      <xsl:value-of select="cap:certainty"/>
                      <BR/>
                      <BR/>
                      <b>Audience: </b>
                      <xsl:value-of select="cap:audience"/>
                      <BR/>
                      <BR/>
                      <b>Sender Name: </b>
                      <xsl:value-of select="cap:senderName"/>
                      <BR/>
                      <BR/>

                      <b>Event Codes </b>
                      <br/>
                      <xsl:for-each select="cap:eventCode">
                        <b>
                          <xsl:value-of select="cap:valueName"/> =
                        </b>
                        <xsl:value-of select="cap:value"/>
                        <br/>
                      </xsl:for-each>

                      <b>Effective: </b>
                      <xsl:value-of select="cap:effective"/>
                      <BR/>
                      <BR/>
                      <b>Onset: </b>
                      <xsl:value-of select="cap:onset"/>
                      <BR/>
                      <BR/>
                      <b>Expires: </b>
                      <xsl:value-of select="cap:expires"/>
                      <BR/>
                      <BR/>
                      <b>Headline: </b>
                      <xsl:value-of select="cap:headline"/>
                      <BR/>
                      <BR/>
                      <b>Description: </b>
                      <xsl:value-of select="cap:description"/>
                      <BR/>
                      <BR/>
                      <b>Instruction: </b>
                      <xsl:value-of select="cap:instruction"/>
                      <BR/>
                      <BR/>
                      <b>Web: </b>
                      <xsl:value-of select="cap:web"/>
                      <BR/>
                      <BR/>
                      <b>Contact: </b>
                      <xsl:value-of select="cap:contact"/>
                      <BR/>
                      <BR/>

                      <b>Parameters: </b>
                      <br/>
                      <xsl:for-each select="cap:parameter">
                        <xsl:value-of select="cap:valueName"/> = <xsl:value-of select="cap:value"/><br/>
                      </xsl:for-each>
                      <br/>


                      <b>Resources: </b>
                      <br/>
                      <xsl:for-each select="cap:resource">
                        Description: <xsl:value-of select="cap:resourceDesc"/><br/>
                        Type: <xsl:value-of select="cap:mimeType"/><br/>
                        Size: <xsl:value-of select="cap:size"/><br/>
                        File: <xsl:value-of select="cap:uri"/><br/>
                        Embedded Data: <xsl:value-of select="cap:derefUri"/><br/>
                        Digest: <xsl:value-of select="cap:digest"/><br/><br/>
                      </xsl:for-each>
                      <br/>






                      <xsl:for-each select="cap:area">
                        <b>Area: </b>
                        <BR/>
                        <BR/>
                        <P CLASS="indented4">
                          <b>Area Description: </b>
                          <xsl:value-of select="cap:areaDesc"/>
                          <BR/>
                          <BR/>

                          <xsl:if test="cap:altitude">
                            <b>Altitude: </b>
                            <xsl:value-of select="cap:altitude"/>
                            <br/>
                          </xsl:if>

                          <xsl:if test="cap:ceiling">
                            <b>Ceiling: </b>
                            <xsl:value-of select="cap:ceiling"/>
                            <br/>
                          </xsl:if>

                          <xsl:if test="cap:geocode">
                            <b>Geocodes </b>
                            <br/>
                            <xsl:for-each select="cap:geocode">
                              <b>
                                <xsl:value-of select="cap:valueName"/> =
                              </b>
                              <xsl:value-of select="cap:value"/>
                              <br/>
                            </xsl:for-each>
                          </xsl:if>

                          <xsl:for-each select="cap:circle">

                            <xsl:variable name="circleData">
                              <xsl:value-of select="." />
                            </xsl:variable>

                            <b>Circle: </b>
                            <xsl:copy-of select="$circleData" />
                            <br/>

                            <img border="0" alt="Map">
                              <xsl:attribute name="src">
                                <xsl:value-of select="csharp:circle($circleData)" />
                              </xsl:attribute>
                            </img>


                          </xsl:for-each>

                          <xsl:for-each select="cap:polygon">
                            Polygon:<br/>
                            <xsl:variable name="myLines">
                              <xsl:value-of select="." />
                            </xsl:variable>

                            <xsl:variable name="myLinesFixed">
                              <xsl:value-of select="csharp:lines($myLines)" />
                            </xsl:variable>


                            <img border="0" alt="Map">
                              <xsl:attribute name="src">
                                <xsl:copy-of select="$myLinesFixed" />
                              </xsl:attribute>
                            </img>

                          </xsl:for-each>



                        </P>

                      </xsl:for-each>
                    </P>
                  </xsl:for-each>

                </P>

              </xsl:for-each>



            </TD>
          </TR>
        </TABLE>







      </BODY>
    </HTML>
  </xsl:template>
</xsl:stylesheet>